### Export a directory or file to the host

The following Dagger Functions return a just-in-time directory and file. These outputs can be exported to the host with `dagger call ... export ...`.

:::note
When a host directory or file is copied or mounted to a container's filesystem, modifications made to it in the container do not automatically transfer back to the host. Data flows only one way between Dagger operations, because they are connected in a DAG. To transfer modifications back to the local host, you must explicitly export the directory or file back to the host filesystem.
:::

<Tabs groupId="language" queryString="sdk">
<TabItem value="go" label="Go">

```go file=../../../cookbook/snippets/export-file-dir/go/main.go
```

</TabItem>
<TabItem value="python" label="Python">

```python file=../../../cookbook/snippets/export-file-dir/python/main.py
```

</TabItem>
<TabItem value="typescript" label="TypeScript">

```typescript file=../../../cookbook/snippets/export-file-dir/typescript/index.ts
```

</TabItem>
<TabItem value="php" label="PHP">

```php file=../../../cookbook/snippets/export-file-dir/php/src/MyModule.php
```

</TabItem>
</Tabs>

#### Examples

- Export the directory returned by the Dagger Function to the `/home/admin/export` path on the host:

    <Tabs groupId="shell">
    <TabItem value="System shell">
    ```shell
    dagger -c 'get-dir | export /home/admin/export'
    ```
    </TabItem>
    <TabItem value="Dagger Shell">
    ```shell title="First type 'dagger' for interactive mode."
    get-dir | export /home/admin/export
    ```
    </TabItem>
    <TabItem value="Dagger CLI">
    ```shell
    dagger call get-dir export --path=/home/admin/export
    ```
    </TabItem>
    </Tabs>

- Export the file returned by the Dagger Function to the `/home/admin/myfile` path on the host:

    <Tabs groupId="shell">
    <TabItem value="System shell">
    ```shell
    dagger -c 'get-file | export /home/admin/myfile'
    ```
    </TabItem>
    <TabItem value="Dagger Shell">
    ```shell title="First type 'dagger' for interactive mode."
    get-file | export /home/admin/myfile
    ```
    </TabItem>
    <TabItem value="Dagger CLI">
    ```shell
    dagger call get-file export --path=/home/admin/myfile
    ```
    </TabItem>
    </Tabs>
